#include "string"
#include "iostream"

using namespace std;

class Require
{
public:
    virtual void execute() = 0 ;
};


class ConcreateRequire:public Require
{
public: 
    void execute() override
    {
        cout<<"do something ..."<<endl;
    }
};

class Command
{
public:
    virtual void call()=0;
};


class ConcrateCommand:public Command
{
public:
    void Add_require(Require* require )
    {
        this->require_ = require;
    }
    void call() override
    {   
        require_->execute();
    }

private:    
    Require* require_;
};


class Invoke
{

public:
    
    void SetCommand(Command* command)
    {
        this->command_ = command;
    }   
    void Call(){
        command_->call();
    }
private:
    Command* command_;
};

int main()
{
    ConcreateRequire* myrequire = new ConcreateRequire();
    ConcrateCommand* mycommand = new ConcrateCommand();

    Invoke myinvoke;
    mycommand->Add_require(myrequire);
    myinvoke.SetCommand(mycommand);
    myinvoke.Call();


    return 0;
}